public class Count9 {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i < 100; i++) {
            int a = 0;
            a = i;
            while(a != 0){
                if(a%10 == 9){
                    count++;
                }
                a /= 10;
            }
        }
        System.out.println(count);
    }
}
